package two.to.test;

import javax.swing.JPanel;

public class GraphPanel extends JPanel {

    /*
     * private static final long serialVersionUID = 1L; private int minCoord; private int maxCoord; private
     * TSPSolution solution = new TSPSolution();
     * 
     * public TSPSolution getSolution() { return solution; }
     * 
     * public void setSolution(TSPSolution solution) { this.solution = solution; }
     * 
     * public void setGraph(Graph graph){ this.solution.setGraph(graph); this.minCoord =
     * solution.getGraph().getMinCoord(); this.maxCoord = solution.getGraph().getMaxCoord(); }
     * 
     * public GraphPanel(int width, int height){ this.setPreferredSize(new Dimension(width, height)); }
     * 
     * public void paint(Graphics g){ super.paint(g); if (this.solution.getGraph() == null){ return; }
     * 
     * Graphics2D g2 = (Graphics2D)g; g2.setColor(Color.BLACK); int counter = 0;
     * 
     * 
     * final int diameter = 2; for (Point currentPoint : this.solution.getGraph()){ int x =
     * normalize(currentPoint.getX()); int y = normalize(currentPoint.getY());
     * //System.out.println(String.format("x: %d y: %d", x, y)); g2.drawOval(x - diameter/2, y - diameter/2,
     * diameter, diameter); } if (this.solution.getCycle() == null){ return; } for (Point point :
     * this.solution.getCycle()){ if (point.getNext() == null){ break; } int x1 = normalize(point.getX()); int
     * y1 = normalize(point.getY()); int x2 = normalize(point.getNext().getX()); int y2 =
     * normalize(point.getNext().getY()); g2.drawLine(x1,y1,x2,y2); g2.drawString(String.valueOf(counter++),
     * x1, y1);
     * 
     * } }
     * 
     * private int normalize (int coord){ double perc = (coord - minCoord)/ (double)(maxCoord-minCoord);
     * double newCoord = perc*this.getPreferredSize().width; return (int)(newCoord);
     * 
     * }
     */
}